HHH-4347 default column names/properties on CompositeUserType #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've created a small patch to allow a CompositeUserType to define a default column mapping (using @columns and @column annotations), which will be concatenated with the name of the property to give unique names for an entity.
I opted to allow the @column annotations instead of the getPropertyNames(), as it is conceptually the same as using these on the property in the entity containing the type today, and it allows for defining other defaults as well (length, precision, nullable, etc).
This means that when annotations are used, they are handled the same whether they are defined on the property (as today) or defined by default on the CompositeUserType, with the only difference being that in the latter case the name defined on the @column annotation will be prefixed by the name of the property. Also, column names are allowed to be different to the names used in queries, at the implementor's discretion.
The patch is backwards-compatible so if any CompositeUserType does not define any of these annotations then everything works the same as before. Also, any @Columns/@column annotations on a property in an entity will override the default defined.
Regards,
Frode Carlsen